<template>
  <div class="content-card">
    <div class="card-header">
      <h2><i class="fas fa-plus-circle mr-2"></i>新建留言</h2>
    </div>
    <div class="card-body">
      <form @submit.prevent="submitForm" class="col-md-14">
        <div class="form-group">
          <label>标题</label>
          <input type="text" v-model="form.title" class="form-control" required>
        </div>
        <div class="form-group">
          <label>内容</label>
          <textarea v-model="form.content" class="form-control" rows="5" required></textarea>
        </div>
        <div class="mt-4">
          <button type="submit" class="btn btn-primary">
            <i class="fas fa-save mr-1"></i>保存
          </button>
          <router-link to="/message" class="btn btn-secondary">
            <i class="fas fa-arrow-left mr-1"></i>返回
          </router-link>
        </div>
      </form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MessageAdd',
  data() {
    return {
      form: {
        title: '',
        content: ''
      }
    }
  },
  methods: {
    submitForm() {
      // TODO: 实现保存留言的API调用
      console.log('保存留言:', this.form)
      this.$router.push('/message')
    }
  }
}
</script>

<style scoped>
/* 卡片样式 */
.content-card {
  margin: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

/* 卡片头部样式 */
.card-header {
  background-color: #2c3e50;
  color: white;
  padding: 1.5rem 2rem;
  border-bottom: none;
  border-radius: 15px 15px 0 0;
}

.card-header h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.card-header i {
  color: #3498db;
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

/* 表单样式 */
.form-group {
  margin-bottom: 1.75rem;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: #333;
}

.form-control {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: #3498db;
  box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* 文本区域样式 */
textarea.form-control {
  min-height: 150px;
  resize: vertical;
  padding: 1rem;
}

/* 按钮样式 */
.btn {
  padding: 0.85rem 1.75rem;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-primary {
  background-color: #3498db;
  border: none;
}

.btn-primary:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.btn-secondary {
  background-color: #6c757d;
  border: none;
}

.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-1px);
}

/* 间距类 */
.mr-2 {
  margin-right: 0.75rem;
}

.mr-1 {
  margin-right: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .card-header h2 {
    font-size: 1.5rem;
  }
  
  .form-control {
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
  }
  
  .btn {
    padding: 0.7rem 1.4rem;
    font-size: 0.9rem;
  }
  
  .form-group {
    margin-bottom: 1.5rem;
  }
}
</style>
